package ups.glre.news.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class LoginForm extends ActionForm {
	private static final long serialVersionUID = 1L;
	
	private String login;
	private String password;

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {		
		ActionErrors errors = new ActionErrors();
		
		if ((login == null) || (login.length() < 1))
			errors.add("login", new ActionError("error.login.required"));
		
		if ((password == null) || (password.length() < 1))
			errors.add("password", new ActionError("error.password.required"));
		
		return errors;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}